import React from 'react'
import './tab.less'
import { useState } from 'react'
// 封装按钮
export default function Tab(props) {
  const { num = 1 } = props;
  let buttonList = [];
  for (let i = 0; i < num; i++) {
    buttonList[i] = i
  }
  const [btnId, setBtnId] = useState(0)
  const { conf } = props;
  return (
    <div className='tab'>
      {
        conf.map((item, index) => {
          return (
            <p key={item.id} onClick={() => setBtnId(item.id)} className={btnId === index ? 'active' : ''}>
              {item.name}
            </p>
          )
        })
      }
    </div>
  )
}

